#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>

using namespace std;

/*
string::size_type
stringLengthSum(string::size_type sumSoFar, const string &s)
{
    return sumSoFar + s.size();
}
*/

int stringLengthSum(int sumSoFar, const string &s)
{
    return sumSoFar + s.size();
}

void test()
{
    set<string> ss = {"Hello", "World", "My", "Name"};
    /*
    *string::size_type lengthSum = 
    *    accumulate(ss.begin(), ss.end(),
    *            static_cast<string::size_type>(0),
    *            stringLengthSum);
    */
    int lengthSum = accumulate(ss.begin(), ss.end(),
            0, stringLengthSum);
    cout << lengthSum << endl;
}

void test1()
{
    vector<float> vf;
    float product = accumulate(vf.begin(), vf.end(), 1.0f, multiplies<float>());
    cout << product << endl;
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}
